package com.jia.utils;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

/**
 * [描述] <br>
 *
 * @author [jia.xiuya] <br>
 * @version 1.0 <br>
 * @taskId <br>
 * @CreateDate 13-8-14 <br>
 * @see com.jia.utils <br>
 * @since V7.3<br>
 */
public class IntentsUtils {
    /**
     * 转到浏览器
     *
     * @param activity .
     */
    public static void invokeWebBrowser(Activity activity) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("http://www.google.com"));
        activity.startActivity(intent);
    }

    /**
     * 转到浏览器搜索
     *
     * @param activity .
     */
    public static void invokeWebSearch(Activity activity) {
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.setData(Uri.parse("http://www.google.com"));
        activity.startActivity(intent);
    }

    /**
     * 打开拨号盘
     *
     * @param activity .
     */
    public static void dial(Activity activity) {
        Intent intent = new Intent(Intent.ACTION_DIAL);
        activity.startActivity(intent);
    }

    /**
     * 打开拨号，有默认号码
     *
     * @param activity .
     */
    public static void call(Activity activity) {
        Intent intent = new Intent(Intent.ACTION_CALL);
        intent.setData(Uri.parse("tel:555–555–5555"));
        activity.startActivity(intent);
    }

    /**
     * 显示地图
     *
     * @param activity .
     */
    public static void showMapAtLatLong(Activity activity) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        //geo:lat,long?z=zoomlevel&q=question-string
        intent.setData(Uri.parse("geo:0,0?z=4&q=business+near+city"));
        activity.startActivity(intent);
    }


    /**
     *
     * @param activity .
     */
    public static void tryOneOfThese(Activity activity) {
        IntentsUtils.invokeWebBrowser(activity);
    }
}
